import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'Home',
        meta: {
            title: '首页',
            keepAlive: true,
            requireAuth: true
        },
        component: () => import('@/components/Home.vue'),
        children:[
            {
                path: '/index',
                name: 'index',
                component: () => import('@/components/Index.vue')
            },
            {
                path: '/chat',
                name: 'chat',
                component: () => import('@/components/games/chat.vue')
            },
            {
                path: '/allCourses',
                name: 'allCourses',
                component: ()=> import('@/components/courses/AllCourses.vue')
            },
            {
                path: '/myCourses',
                name: 'myCourses',
                component: ()=> import('@/components/courses/MyCourses.vue')
            },
            {
                path: '/detail/:timestamp',
                name: 'detail',
                component: ()=> import('@/components/courses/Detail.vue')
            },
            {
                path: '/aboutUs',
                name: 'aboutUs',
                component: ()=> import('@/components/about/AboutUs.vue')
            },
            {
                path: '/talk',
                name: 'talk',
                component: ()=> import('@/components/chat/Talk.vue')
            },
            {
                path: '/talkDetail/:timestamp',
                name: 'talkDetail',
                component: ()=> import('@/components/chat/TalkDetail.vue')
            },
            {
                path: '/create',
                name: 'create',
                component: ()=> import('@/components/chat/Create.vue')
            },
            {
                path: '/exam',
                name: 'exam',
                component: ()=> import('@/components/exam/ExamList.vue')
            },
            {
                path: '/userDetail',
                name: 'userDetail',
                component: ()=> import('@/components/UserDetail.vue')
            },
            {
                path: '/examDetail',
                name: 'examDetail',
                component: ()=> import('@/components/exam/ExamDetail.vue')
            },
            {
                path: '/examInfo',
                name: 'examInfo',
                component: ()=> import('@/components/exam/ExamInfo.vue')
            },
            {
                path: '/examCorrect',
                name: 'examCorrect',
                component: ()=> import('@/components/exam/ExamCorrect.vue')
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        meta: {
            title: '登陆',
            keepAlive: true,
            requireAuth: true
        },
        component: () => import('@/components/Login.vue')
    },
    {
        path: '/registration',
        name: 'registration',
        meta: {
            title: '注册',
            keepAlive: true,
            requireAuth: true
        },
        component: ()=> import('@/components/Registration.vue')
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes
});
export default router;
